package com.kylin.shared.enums;

import com.kylin.shared.common.consts.Constants;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 启、停状态
 * 这是一种延续性的状态
 * @author Damon S.
 */
@Getter
@RequiredArgsConstructor
public enum SwitchState {
    /**1开启，0关闭，-1不可用*/
    ON(1), OFF(0), NA(-1);

    private final int code;

    public static SwitchState parse(int code) {
        return code > Constants.INT_ZERO ? ON : (code < Constants.INT_ZERO ? NA : OFF);
    }
}